//
// Created by HP on 2024/2/23.
//

#ifndef AURORA_ST_AURORA_WAVE_H
#define AURORA_ST_AURORA_WAVE_H


#include "common_inc.h"
#include "aurora_label.h"

//LCD 波形显示
class  Aurora_Wave{
#define WAVE_X_LEN 240
#define WAVE_X_OFFSET 40
#define WAVE_MAX 6
public:
    Aurora_Wave(LCD_Driver *lcd = nullptr,Aurora_Font *font = nullptr);
    ~Aurora_Wave();

    void add_Driver(LCD_Driver *lcd,Aurora_Font *font);
public:

    void setYMaxMin(float max,float min);

    void addWaveData(Aurora_FOC2UI_Wave data);

    void bresenham(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,uint16_t color);

    void wave_label_init();

    void update_maxmin_value(float data_max,float data_min);

    void switch_prev_wave();
    void switch_next_wave();


    void wave_TaTbTc(uint8_t Mx);
    void wave_IaIbIc(uint8_t Mx);
    void wave_IqId(uint8_t Mx);



private:
    Aurora_Label title_label;
    Aurora_Label motor_label;
    Aurora_Label wave1_label;
    Aurora_Label wave2_label;
    Aurora_Label wave3_label;
    Aurora_Label maxvalue_label;
    Aurora_Label minvalue_label;

    LCD_Driver *_lcd;
    Aurora_Font *_font;



    int16_t Yaxis_Max;
    int16_t Yaxis_Min;
    uint16_t YStart,Yend;

    uint16_t wave_data[3][WAVE_X_LEN]; // 波形数据
    uint16_t wave_color[3];     // 波形的颜色
    uint16_t wave_buff[WAVE_X_LEN * (170 - 100)];

    uint8_t wave_index;


    uint8_t data_in;
};



#endif //AURORA_ST_AURORA_WAVE_H

